#include "ros/ros.h"
#include <sensor_msgs/Imu.h>
#include <iostream>

void ImuCallback(const sensor_msgs::Imu::ConstPtr& msg)
{
    sensor_msgs::Imu currImu;
    currImu = *msg;
    std::cout << std::to_string(currImu.header.stamp.toSec())<<" "
    << currImu.angular_velocity.x <<" "
    << currImu.angular_velocity.y <<" "
    << currImu.angular_velocity.z <<" "
    << currImu.linear_acceleration.x <<" "
    << currImu.linear_acceleration.y << " " 
    << currImu.linear_acceleration.z << std::endl;
}

int main(int argc, char** argv)
{
    ros::init(argc,argv, "imu_listener");
    ros::NodeHandle nh("~");
    ros::Subscriber imuSub = nh.subscribe<sensor_msgs::Imu>("/imu_publish/imu_data",10, ImuCallback);
    ros::spin();
    return 0;
}
